<template>
  <div>
    <el-col :span="24" class="bg1">
      <div class="grid-content bg-purple">
        <FormPanel
          ref="formPanel" :list="formList" :cols="3" :isSubmitBtn="false"/>
      </div>
    </el-col>
    <div class="dialogBottmView">
      <el-button size="small" type="primary" class="btnStyle" @click="closeMenu('1')">确定
      </el-button>

      <el-button size="small" type="primary" class="btnStyle" @click="closeMenu('2')">关闭
      </el-button>
    </div>

  </div>
</template>

<script>
  import {mapState} from 'vuex';
  import {dictionary} from '@/utils/dictMixin';
  import moment from 'moment';
  import {isEmpty} from '@/utils/utils';
  import {byAllInfo} from '@/api/repair/newEnergyVehicleLifetime/vehicleLifetimeReviewQueryJingxsDuan';
  import {arrayObjDeWeight} from '@/utils';

  export default {
    name: 'addItem',
    mixins: [dictionary],
    props: ['batchType'],
    data()
    {
      this.BaseTable = null;
      return {
        dialogTitle: '',
        formList: this.createFormList(),
        selectArr: []
      };
    },
    components: {},

    mounted()
    {

    },
    methods: {

      createFormList()
      {
        return [
          {
            type: 'TEXT_AREA',
            label: this.batchType == 1 ? '审核原因' : '驳回原因',
            selfCols: 3,
            fieldName: 'remarks',
            disabled: false,
            placeholder: '',
            rules: [{required: true, trigger: 'change', message: '请输入审核原因'}],
            initialValue: '',
          },
        ]
      },

      async closeMenu(type)
      {
        if (type == '1')
        {
          let remarks = this.formList.find(item => item.fieldName == 'remarks').initialValue
          if (isEmpty(remarks))
          {
            this.$notify.warning({title: '提示信息', message: '驳回原因不能为空'});
            return
          }
          this.$emit('inputReason', remarks)

        } else
        {
          this.$emit('close')
        }

      },
    }
  };
</script>

<style lang="less" scoped>
  .bg1 {
    border: 1px solid @borderColor;
    border-radius: @borderRadius;
    box-shadow: @boxShadow;
    padding: @modulePadding;
    padding-left: 0;
    padding-top: 15px;
    padding-bottom: 15px;
  }

  .bg2 {
    margin-top: 10px;
    margin-bottom: 10px;
  }

  .btn {
    text-align: center;
  }

  .btnStyle {
    margin-top: 10px;
  }

</style>

